import { Module } from '@nestjs/common';
import { SiteService } from './site.service';
import { SiteController } from './site.controller';
import { Site } from './entities/site.entity';
import { DatabaseProviders } from '@app/comm/database/database.providers';

@Module({
  controllers: [SiteController],
  providers: [
    ...DatabaseProviders,
    SiteService,
    {
      provide: 'SITE_REPOSITORY',
      useFactory: async (AppDataSource) => {
        return AppDataSource.getRepository(Site);
      },
      inject: ['MONGODB_DATA_SOURCE'],
    }
  ],
  exports: ['SITE_REPOSITORY'],
})
export class SiteModule {}